package com.tzbank.poc.serviceimpl;

import com.github.pagehelper.PageHelper;
import com.tzbank.poc.dao.TradeMapper;
import com.tzbank.poc.model.Trade;
import com.tzbank.poc.service.TradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author li_zheng2
 * Created by Administrator on 2019/1/23 0023.
 */
@Service(value = "tradeService")
public class TradeServiceImpl implements TradeService {

    @Autowired
    private TradeMapper tradeMapper;

    @Override
    public int addTradeInfo(Trade trade) {
        return tradeMapper.insertSelective(trade);
    }

    @Override
    public BigDecimal queryInAmount(Map map) {
        return tradeMapper.queryInAmount(map);
    }

    @Override
    public BigDecimal queryOutAmount(Map map) {
        return tradeMapper.queryOutAmount(map);
    }

    @Override
    public Trade queryTradeInfoDetail(String tradeSeq) {
        return tradeMapper.selectByPrimaryKey(tradeSeq);
    }

    @Override
    public List<Trade> queryTradeList(Map bodyMap, int pageNum, int intPage) {
        PageHelper.startPage(intPage,pageNum);
        return tradeMapper.queryTradeList(bodyMap);
    }
}
